#include <Unit.h>


unsigned int lengthRatio[END_LENGTH] = {
				1, 
				INCH_PER_FEET, 
				INCH_PER_FEET * FEET_PER_YARD,
				INCH_PER_FEET * FEET_PER_YARD * YARD_PER_MILE,
				};

unsigned int volumeRatio[END_VOLUME] = {
				1,
				TSP_PER_TBSP,
				TSP_PER_TBSP * TBSP_PER_OZ
				};


Unit::Unit(MEASURE_TYPE measure, LENGTH_TYPE lengthType): m_type(measure)
{
	m_ratio = lengthRatio[lengthType];
}


Unit::Unit(MEASURE_TYPE measure, VOLUME_TYPE volumeType): m_type(measure)
{
	m_ratio = volumeRatio[volumeType];
}


unsigned int Unit::getRatio()
{
	return m_ratio;
}


MEASURE_TYPE Unit::getMeasureType()
{
	return m_type;
}


bool Unit::operator == (const Unit & unit) const
{
	return (m_type == unit.m_type);
}

